package xman.mssh.hibernate.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "tb_m2m_mapped")
public class Many2ManyMappedEntity {
    
    @Id
    @Column
    @GeneratedValue
    private Integer id;
    
    @ManyToMany(cascade = { CascadeType.ALL }, mappedBy = "mapped")
    // @JoinTable(name = "tb_m2m_ref", joinColumns = { @JoinColumn(name = "mapped_id") }, inverseJoinColumns = {
    // @JoinColumn(name = "ref_id") })
    private Set<Many2ManyEntity> refer;

    private String descr;
    
    @Temporal(TemporalType.TIMESTAMP)
    private Date utime;
    
    public Integer getId() {
        return id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
    
    public String getDescr() {
        return descr;
    }
    
    public void setDescr(String descr) {
        this.descr = descr;
    }
    
    public Date getUtime() {
        return utime;
    }
    
    public void setUtime(Date utime) {
        this.utime = utime;
    }
    
    public Set<Many2ManyEntity> getRefer() {
        return refer;
    }
    
    public void setRefer(Set<Many2ManyEntity> refer) {
        this.refer = refer;
    }
    
}
